<template>
  <div class="product-attribute">
<!--    ？-->
    <el-steps :active="3" align-center>
      <el-step title="填写商品信息" icon="el-icon-edit"></el-step>
      <el-step title="填写商品属性" icon="el-icon-price-tag"></el-step>
      <el-step title="添加商品图片" icon="el-icon-picture"></el-step>
      <el-step title="选择商品关联" icon="el-icon-connection"></el-step>
    </el-steps>

    <el-form :model="attributeForm" label-width="120px" class="form-container">
      <!-- 商品相册 -->
      <el-form-item label="商品相册">
        <div class="upload-container custom-scrollbar">
          <el-upload
            action="#"
            list-type="picture-card"
            :auto-upload="false"
            :on-preview="handlePictureCardPreview"
          >
            <i class="el-icon-plus"></i>
          </el-upload>
        </div>
      </el-form-item>
    </el-form>

    <div class="button-container">
      <el-button @click="goBack" size="medium">上一步，填写商品促销</el-button>
      <el-button type="primary" @click="goNext" size="medium">下一步，选择商品关联</el-button>
    </div>
  </div>
</template>

<script>
// import axios  from "axios";
export default {
  name: 'ProductAttribute',
  data() {
    return {
      imagelist:null,
    }
  },
  computed: {
    attributeForm: {
      get() {
        return this.attribute
      },
      set(value) {
        this.UPDATE_ATTRIBUTE(value)
      }
    }
  },
  methods: {
    handlePictureCardPreview(file) {
      this.previewUrl = URL.createObjectURL(file.raw);
      // 处理图片预览
      console.log(file)
    },
    goBack() {
      console.log('Navigating to: /home/addProduct/productPromotion');
      this.$router.push('/home/addProduct/productPromotion')
    },
    goNext() {
      this.$router.push('/home/addProduct/productRelation')
    },

   // handleUploadSuccess(response, file) {
   //   // 假设上传成功后，将图片URL添加到 Vuex store
   //   this.$store.commit('productForm/UPDATE_ATTRIBUTE', {
   //     imageList: [...this.attributeForm.imageList, response.url]
   //   })
   // }
}


}
</script>

<style scoped>
.product-attribute {
  padding: 30px;
  background: linear-gradient(to bottom, #ffffff, #f8f9fa);
  border-radius: 15px;
  height: calc(100vh - 120px);
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

page-header {
  text-align: center;
  margin: 30px 0 40px;
}

.page-header h2 {
  color: #2c3e50;
  font-size: 24px;
  margin-bottom: 10px;
}

.custom-steps {
  margin-bottom: 40px;
  padding: 20px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

:deep(.el-step__title.is-process) {
  color: #409EFF;
  font-weight: 600;
}

:deep(.el-step__head.is-process) {
  border-color: #409EFF;
  color: #409EFF;
}


/* 主容器滚动条 */
.product-attribute::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.editor-container::-webkit-scrollbar-thumb {
  border-radius: 3px;
  background-color: #c0c4cc;
  transition: background-color 0.3s;
}

/* 上传组件容器样式 */
.upload-container {
  padding: 10px;
  border: 1px dashed #d9d9d9;
  border-radius: 4px;
  max-height: 300px;
  overflow-y: auto;
}
</style> 